﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Pager.ascx.cs" Inherits="$rootnamespace$.Controls.Pager" %>

<%@ Register TagPrefix="ow" Namespace="OpenWaves.Pagination.Controls" Assembly="OpenWaves.Pagination" %>

<%@ Import Namespace="OpenWaves" %>

<ow:Pager runat="server">
    <Template>
        <ow:PageButton runat="server" Page="<%# Model.PreviousPage%>" Text="Previous" CssClass="prev"/>

        <ow:PageRepeater runat="server" DataSource="<%# Model.VisiblePages%>">
            <ItemTemplate>
                <ow:PageButton runat="server" Page="<%#Container.Item%>" />
            </ItemTemplate>
        </ow:PageRepeater>

        <ow:PageButton runat="server" Page="<%# Model.NextPage%>" Text="Next" CssClass="next"/>
    </Template>

    <PageButtonTemplate>
        <a href="<%# GetPageUrl(Container.Page) %>" class="<%# Container.CssClass %>">
			<%# Html.Encode(Container.Text ?? Container.Page.Number.ToString()) %>
		</a>
    </PageButtonTemplate>

    <UnavailablePageButtonTemplate>
        <%-- 
            Cannot use Container.Page here as it is unavailable, but can use Container.Text and Container.CssClass.
            Remove the UnavailablePageButtonTemplate if you don't want unavailable pages to be rendered.
        --%>

        <span class="<%# Container.CssClass %>"><%# Html.Encode(Container.Text) %></span>
    </UnavailablePageButtonTemplate>

    <SelectedPageButtonTemplate>
        <span class="selected">
			<%# Html.Encode(Container.Page.Number.ToString()) %>
		</span>
    </SelectedPageButtonTemplate>
</ow:Pager> 